#ifndef ATTRIBUTESET_H
#define ATTRIBUTESET_H

#include <QGraphicsWidget>
#include <QGraphicsObject>
#include <QVector>
#include <QList>
#include <QString>
#include <QPainter>
#include <QPointer>
#include <QColor>
#include <QDebug>
#include <QListIterator>
#include <iostream>
#include <QGraphicsLinearLayout>
#include <QPushButton>
#include <QGraphicsProxyWidget>

class BioSageLabel;

class QualAttribute : public QGraphicsObject
{
    Q_OBJECT
public:
    QualAttribute(QString& dataVal, QString& attVal, QGraphicsItem *parent = 0);
    QualAttribute(const QualAttribute & other );

    QString getAttributeValue() const;
    void setAttributeValue(const QString& newValue);

    QString getDataValue() const;
    void setDataValue(const QString& newValue);

    QColor getColor() const;
    void setColor(const QColor& newColor);

    friend QDebug operator <<( QDebug out, const QualAttribute & q );
protected:
    QRectF boundingRect() const;
    QPainterPath shape() const;
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
               QWidget *widget);
signals:

public slots:

private:
    QString dataValue;//gene ATMPK1
    QString attributeValue;//upReg
    QColor color;


};

//-----------------------------------------------------------------------------------------------

class QualAttributeSet : public QGraphicsWidget
{
    Q_OBJECT
public:
    explicit QualAttributeSet(QString name, QList<QString>& dataElts, QList<QString>& attElts, QGraphicsItem *parent = 0);
    QualAttributeSet( const QualAttributeSet &other );
    QualAttributeSet& operator=( const QualAttributeSet &rhs );

    friend QDebug operator <<( QDebug out, const QualAttributeSet & q );

    QPointer<QualAttribute> getAttribute(int idx) const;
    int getNumberOfAttributes() const;

signals:

public slots:

protected:
    QRectF boundingRect() const;
    QPainterPath shape() const;
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
               QWidget *widget);

private:
    QString name;
    QVector< QPointer <QualAttribute> > attributes;//specific attributes in this set- eg. gene1-upreg; gene2-downreg; gene3-upreg, gene4-noChange
    QVector< QPointer <QualAttribute> > attributeDomain;//domain from which attributes are derived- upreg, downreg, noChange
    QVector< QPointer <QColor> > attributeColors; //greed, red, black
    QVector< QPointer <BioSageLabel> > attributeLabels;
    //QVector< QPointer <QPushButton> > attributeLabels;
    QVector< QPointer <QGraphicsProxyWidget> > attributeProxyLabels;
    QGraphicsLinearLayout *layout;

    QPushButton* p;
    QGraphicsProxyWidget* pw;
};

//---------------------------------------------------------------------------------------------------

QDebug operator <<( QDebug out, const QualAttribute & q );
QDebug operator <<( QDebug out, const QualAttributeSet & q );

#endif // ATTRIBUTESET_H
